package com.financing.wap.service.impl;


import java.sql.SQLException;
import java.util.List;

import com.financing.wap.common.CommonConstantUtil;
import com.financing.wap.util.DTOdateSetUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.financing.wap.dto.PrUserBankCardDTO;
import com.financing.wap.service.IPrUserBankCardService;
import com.financing.wap.dao.IPrUserBankCardDao;
/**
 * pr_user_bank_card  
 * 账户银行卡 业务访问层实现类
 * @author huqiyun
 *
 */
 
@Service("prUserBankCardService")
public class PrUserBankCardServiceImpl implements IPrUserBankCardService{

	@Autowired
	private IPrUserBankCardDao prUserBankCardDao;

	@Override
	public int insert(PrUserBankCardDTO prUserBankCard) throws SQLException {
		DTOdateSetUtil.setCreateInfo(prUserBankCard);
		DTOdateSetUtil.setUpdateInfo(prUserBankCard);
		prUserBankCard.setDeleteTag(CommonConstantUtil.CommonStatus.DELETE_TAG_NORMAL);
		return prUserBankCardDao.insert(prUserBankCard);
	}

	@Override
	public void update(PrUserBankCardDTO prUserBankCard) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(prUserBankCard);
		prUserBankCardDao.update(prUserBankCard);
	}

	@Override
	public void updateForce(PrUserBankCardDTO prUserBankCard) throws SQLException {
		DTOdateSetUtil.setUpdateInfo(prUserBankCard);
		prUserBankCardDao.updateForce(prUserBankCard);
	}

	@Override
	public void delete(Integer id) throws SQLException {
		prUserBankCardDao.delete(id);
	}
	
	@Override
	public List<PrUserBankCardDTO> queryList(PrUserBankCardDTO prUserBankCard) throws SQLException {
		return prUserBankCardDao.queryList(prUserBankCard);
	}

	@Override
	public int queryListCount(PrUserBankCardDTO prUserBankCard) throws SQLException {
		return prUserBankCardDao.queryListCount(prUserBankCard);
	}

	@Override
	public PrUserBankCardDTO loadById(Integer id) throws SQLException {
		return prUserBankCardDao.loadById(id);
	}
 	@Override
	public PrUserBankCardDTO queryListGetFirst(PrUserBankCardDTO prUserBankCard)
			throws SQLException {
		 List<PrUserBankCardDTO> queryList = queryList(prUserBankCard);
		 if(queryList==null||queryList.size()==0){
			 return new PrUserBankCardDTO();
		 }
		 return queryList.get(0);
	}
}
